<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>会员类型管理</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#cfcfcf;">
  <form name="form1" action="member_type.php" method="post">
    <input type="hidden" name="dopost" value="save" />
    <tr>
      <td height="24" colspan="8" bgcolor="#EDF9D5" background='images/tbg.gif'>
      	<table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="30%"  style="padding-left:10px;"><strong>会员产品分类：</strong></td>
            <td align="right" style="padding-top:4px;">
            	<input type="button" name="ss1" value="会员级别管理" style="width:90px;margin-right:6px" onClick="location='member_rank.php';" class='np coolbg' />
              <input type="button" name="ss2" value="会员业务记录" style="width:90px" onClick="location='member_operations.php';" class='np coolbg' />
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr bgcolor="#FBFCE2">
      <td width="15%" height="24" align="center" valign="top">产品名称</td>
      <td width="10%" align="center" valign="top">会员级别</td>
      <td width="10%" align="center">产品价格</td>
      <td width="10%" align="center">会员期限(天)</td>
      <td width="10%" align="center">状态</td>
      <td width="10%" align="center">折扣</td>
      <td width="20%" align="center">折扣截止天数</td>
      <td width="20%" align="center">折扣截止日期</td>
    </tr>
    <?php
    $dsql->SetQuery("Select * From #@__member_type");
    $dsql->Execute();
    $k=0;
    while($row = $dsql->GetObject())
    {
    	$k++;
	?>
    <input type="hidden" name="ID_<?php echo $k?>" value="<?php echo $row->aid?>" />
    <tr align="center" bgcolor="#FFFFFF">
      <td height="24" valign="top">
      	<input name="pname_<?php echo $k?>" value="<?php echo $row->pname?>"
      	 type="text" id="pname_<?php echo $k?>" style="width:90%"  class='pubinputs' />
      </td>
      <td height="24" valign="top">
      	<select name='rank_<?php echo $k?>' id='rank_<?php echo $k?>' style='width:90%' />
          <?php
          foreach($arcranks as $kkk=>$vvv){
          	if($row->rank==$kkk) echo "    <option value='{$kkk}' selected>{$vvv}</option>\r\n";
          	else echo "    <option value='{$kkk}'>{$vvv}</option>\r\n";
          }
	   	?>
       </select>
      </td>
      <td>
      	<input name="money_<?php echo $k?>" value="<?php echo $row->money?>"
      	 type="text" id="money_<?php echo $k?>" style="width:80%" class='pubinputs' />
        (元)
       </td>
      <td>
      	<select name='exptime_<?php echo $k?>' id='exptime_<?php echo $k?>' style='width:90%'>
          <?php
          foreach($times as $kkk=>$vvv){
          	if($row->exptime==$kkk) echo "    <option value='{$kkk}' selected>{$vvv}</option>\r\n";
          	else echo "    <option value='{$kkk}'>{$vvv}</option>\r\n";
          }
	   	?>
        </select> 
       </td>
      <td>
      	<input name="check_<?php echo $k?>" type="checkbox" id="check_<?php echo $k?>"  value="1" checked='1' class='np' />
        保留
       </td>
        <td>
            <input type="text" name="discount_<?php echo $k?>" value="<?php echo $row->discount?>"  id="discount_<?php echo $k?>"placeholder="折扣 如：8">折
        </td>
        <td>
            <?php if(date('Y-m-d H:i:s') > $row->end_time && $row->end_time != '0000-00-00 00:00:00'){ ?>
                <input type="text" name="end_time_date_<?php echo $k?>" value="0" placeholder="折扣截止日期 如：180">天
            <?php }else{ ?>
                <input type="text" name="end_time_date_<?php echo $k?>" value="<?php echo $row->end_time_date?>" placeholder="折扣截止日期 如：180">天
            <?php } ?>
        </td>
        <td>
            <?php if(date('Y-m-d H:i:s') > $row->end_time && $row->end_time != '0000-00-00 00:00:00'){
            $query_end = "UPDATE #@__member_type SET end_time_date='0' WHERE aid='$row->aid'";
            $dsql->ExecuteNoneQuery($query_end);
            ?>
            已过期：<input style="color: red;" type="text" value="<?php echo $row->end_time?>" disabled>
            <?php }else{ ?>
            <input type="text" value="<?php echo $row->end_time?>" disabled>
            <?php } ?>
        </td>
    </tr>
    <?php
    }
	?>
    <input type="hidden" name="idend" value="<?php echo $k?>">
    <tr bgcolor="#F9FCEF">
      <td height="24" colspan="7" valign="top">&nbsp;<strong>新增一个会员产品类型：</strong></td>
    </tr>
    <tr height="24" align="center" bgcolor="#FFFFFF">
      <td valign="top">
      	<input name="pname_new" type="text" id="pname_new" style="width:90%"  class='pubinputs' />
      </td>
      <td valign="top">
      	<select name='rank_new' id='rank_new' style='width:90%'>
          <?php
          foreach($arcranks as $kkk=>$vvv){
          	echo "    <option value='{$kkk}'>{$vvv}</option>\r\n";
          }
	   	?>
       </select>
       </td>
      <td valign="top">
      	<input name="money_new" type="text" id="money_new" style='width:80%' value="100"  class='pubinputs' />
        (元)
       </td>
      <td valign="top">
      	<select name='exptime_new' id='exptime_new' style='width:90%'>
          <?php
          foreach($times as $kkk=>$vvv){
          	echo "    <option value='{$kkk}'>{$vvv}</option>\r\n";
          }
	   	?>
        </select>
        </td>
        <td align="center" bgcolor="#FFFFFF">
            <input name="check_new" type="checkbox"  id="check_new" value="1" checked='1' class='np' />
            新增
        </td>
        <td valign="top">
            <input type="text" name="discount_new" id='discount_new' placeholder="折扣 如：8">折
        </td>
        <td valign="top">
            <input type="text" name="end_time_date_new" id='end_time_date_new' placeholder="折扣截止日期 如：180">天
        </td>

    </tr>
    <tr>
      <td height="24" colspan="8" bgcolor="#ffffff">&nbsp;</td>
    </tr>
    <tr>
      <td height="34" colspan="8" align="center" bgcolor="#F9FCEF">
      	<input name="imageField"  type="submit" class="np coolbg" value="确定" class='np coolbg /' />
      </td>
    </tr>
  </form>
</table>
</body>
</html>
